package by.yakusekmaxim.bookgid.webapp.page.utils.renderer;

import org.apache.wicket.markup.html.form.IChoiceRenderer;
import org.apache.wicket.model.ResourceModel;

import by.yakusekmaxim.bookgid.datamodel.enums.UserStatus;

public class UserStatusRenderer implements IChoiceRenderer<UserStatus> {

	public static UserStatusRenderer INSTANCE = new UserStatusRenderer();
	
	@Override
	public Object getDisplayValue(UserStatus object) {
		if (object == UserStatus.userstatus_active) {
			return new ResourceModel("p.admin.user.status.active").getObject();
		}

		if (object == UserStatus.userstatus_locked) {
			return new ResourceModel("p.admin.user.status.locked").getObject();
		}

		if (object == UserStatus.userstatus_inactive) {
			return new ResourceModel("p.admin.user.status.inactive").getObject();
		}
		return null;
	}

	@Override
	public String getIdValue(UserStatus object, int index) {
		
		return object.name();
	}

}
